package com.gowants.pems.controller;

import com.gowants.pems.aspect.Importance;
import com.gowants.pems.aspect.OperType;
import com.gowants.pems.aspect.ScmsAopLog;
import com.gowants.pems.config.AccessLimit;
import com.gowants.pems.service.RedisService;
import com.gowants.pems.util.JSONList;
import com.gowants.pems.util.JSONMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/redis")
public class RedisController extends BaseController{

	@Autowired
	private RedisService redisService;
	
	@RequestMapping(value = "/Keys", method = RequestMethod.POST)
	@AccessLimit(seconds = 1, maxCount = 3,needLogin=true) //1秒内 允许请求3次
	@ScmsAopLog(description = "redis 所有key值查看", opType = OperType.execute, importance = Importance.commonly)
	public JSONMap Keys(String request, HttpServletRequest req) {
		JSONList js=redisService.Keys();
		return doResponse(req, "", js);
	}
	
	
}
